//
//  GWStatuseToolBar.m
//  新浪微博
//
//  Created by qianfeng on 16/2/18.
//  Copyright (c) 2016年 高炜. All rights reserved.
//

#import "GWStatuseToolBar.h"
#import "GWStatuseModel.h"
@interface GWStatuseToolBar()
@property (nonatomic,strong)NSMutableArray *deviderArray;

@end

@implementation GWStatuseToolBar

-(NSMutableArray *)deviderArray
{
    if (_deviderArray ==nil) {
        _deviderArray=[NSMutableArray array];
    }
    return _deviderArray;
}
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self =[super initWithFrame:frame]) {
        
        
        [self setupDevider];
        [self setupDevider];
    }
    return self;
}

-(void)setupDevider
{
    UIImageView *devideView =[[UIImageView alloc]init];
    devideView.image =[UIImage imageNamed:@"timeline_card_bottom_line"];
    devideView.contentMode =UIViewContentModeCenter;
    [self addSubview:devideView];
    [self.deviderArray addObject:devideView];
}

-(void)layoutSubviews
{
    [super layoutSubviews];

    NSInteger deviderCount =self.deviderArray.count;
    CGFloat btnH =self.height;
     CGFloat btnW =self.width/(deviderCount+1);
    for (int i =0; i<deviderCount; i++) {
        UIImageView *devider =self.deviderArray[i];
        devider.width =4;
        devider.height =btnH;
        devider.center =CGPointMake((i+1)*btnW, btnH*0.5);
    }
    
}
-(void)drawRect:(CGRect)rect
{
    [[UIImage reSizeWithName:@"timeline_card_bottom_background"]drawAsPatternInRect:rect];
}

@end
